("Use USB IDs to specify printer:", "-s bbb:ddd, where bbb is the USB bus ID and ddd is the USB device ID. The ':' and all leading zeroes must be present.", "option", False),
("Seconds to delay before download:", "-y<secs> or --delay=<secs> (float value, e.g. 0.5)", "option", False)],
see_also_list=['hp-plugin', 'hp-toolbox'])
opts, device_uri, printer_name, mode, ui_toolkit, lang = \
mod.parseStdOpts('y:s:', ['delay='])
device_uri = None
printer_name = None
usb_bus_node = None
usb_bus_id = None
usb_device_id = None
silent = False
delay = 0.0
for o, a in opts:
if o == '-s':
silent = True
try:
usb_bus_id, usb_device_id = a.split(":", 1)
log.debug("USB bus ID: %s" % usb_bus_id)
log.debug("USB device ID: %s" % usb_device_id)
except ValueError:
log.error("Invalid USB IDs: %s" % a)
sys.exit(1)
if len(usb_bus_id) != 3 or len(usb_device_id) != 3:
log.error("Invalid USB IDs '%s'. Must be the format: bbb.ddd" % a)
sys.exit(1)
usb_bus_node = a
mode = NON_INTERACTIVE_MODE
elif o in ('-y', '--delay'):
try:
delay = float(a)
except ValueError:
log.error("Invalid delay value. Must be numeric (float) value. Setting delay to 0.0")